package cn.softgame.jserver.application.user;

import java.util.HashMap;
import java.util.Map;

import cn.softgame.jserver.connector.Connector;

/**
 * 保存用户相关状态
 * 连接状态
 * @author xuquan
 * 日期:2013-5-28
 */
public class UserPool {
	private static UserPool userPool = new UserPool();
	private final static Map<Integer,Connector> users = new HashMap<Integer,Connector>();
	public static UserPool getInstance(){
		return userPool;
	}
	
	public synchronized void save(int userId,Connector connector){
		users.put(userId,connector);
	}
	
	public synchronized Connector load(int userId){
		return (Connector)users.get(userId);
	}
}
